<%-- 
    Document   : usuarioDetalhe
    Created on : 27/10/2010, 20:08:05
    Author     : renan
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<f:view>
    <h:form id="DEUsuario">
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <link rel="stylesheet" type="text/css" href="../../css/style.css">
                <script type="text/javascript" src="../../js/funcoes.js"></script>
                <title>Cadastro de Usuários</title>
            </head>
            <body onload="foco();">
                <table width="100%">
                    <tr>
                        <td align="left">
                            <a4j:commandButton id="btInserir"  image="../../imagens/salvar.png" action="#{usuarioFrm.gravar}"
                                             title="Gravar novo registro" onmouseover="mouseSobre(this);" onmouseout="mouseSai(this);"
                                             onmousedown="mouseClicou(this);" onmouseup="mouseDesclicou(this);"
                                             reRender="nome,login,nivel,senha,situacao"/>
                            <a4j:status>
                                <f:facet name="start">
                                    <h:graphicImage value="../../imagens/ajax-loader.gif"/>
                                </f:facet>
                            </a4j:status>
                        </td>
                        <td align="right">
                            <a4j:commandButton image="../../imagens/sair.png" action="#{usuarioFrm.fechar}"
                                   title="Fechar" onmouseover="mouseSobre(this);" onmouseout="mouseSai(this);"
                                   onmousedown="mouseClicou(this);" onmouseup="mouseDesclicou(this);"/>
                        </td>
                    </tr>
                </table>
                <table width="100%" align="center">
                    <tr>
                        <td>
                            <rich:panel id="painelCadastro" styleClass="tituloTabela">
                                <f:facet name="header">
                                    <h:outputText value="Cadastro de Usuários"></h:outputText>
                                </f:facet>
                                <h:panelGrid columns="1" styleClass="rotulo">
                                    <h:column><h:outputText styleClass="rotulo" value="Nome:"/></h:column>
                                    <h:column><h:inputText id ="nome" onkeydown="mascara(this,maiusculo);" onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);" size="50" maxlength="100" value="#{usuarioFrm.usuario.usuario.nome}"/></h:column>
                                    <h:column><h:outputText styleClass="rotulo" value="Login:"/></h:column>
                                    <h:column><h:inputText id="login" size="50" maxlength="14" onkeydown="mascara(this,maiusculo)" onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);"  value="#{usuarioFrm.usuario.usuario.login}"/></h:column>
                                    <h:column><h:outputText styleClass="rotulo" value="Nível:"/></h:column>
                                    <h:column>
                                        <h:selectOneMenu id="nivel" value="#{usuarioFrm.usuario.usuario.nivel}" styleClass="campo"
                                                         onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);">
                                            <f:selectItems value="#{usuarioFrm.nivel}"/>
                                        </h:selectOneMenu>
                                    </h:column>
                                    <h:column><h:outputText styleClass="rotulo" value="Senha:"/></h:column>
                                    <h:column><h:inputSecret id="senha" size="50" maxlength="14" onkeydown="mascara(this,senha)" onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);"  value="#{usuarioFrm.usuario.usuario.senha}"/></h:column>
                                    <h:column><h:outputText styleClass="rotulo" value="SITUAÇÃO:"/></h:column>
                                    <h:column>
                                        <h:selectOneMenu id="situacao" value="#{usuarioFrm.usuario.usuario.situacao}" styleClass="campo"
                                                         onfocus="ganhouFoco(this);" onblur="perdeuFoco(this);">
                                            <f:selectItems value="#{usuarioFrm.situacao}"/>
                                        </h:selectOneMenu>
                                    </h:column>
                                </h:panelGrid>
                            </rich:panel>
                            <!-- AREA DE MENSAGENS -->
                            <h:panelGroup id="erros">
                                <rich:messages globalOnly="true" layout="table" styleClass="textoErro">
                                    <f:facet name="errorMarker">
                                        <h:graphicImage value="../../imagens/important.png"/>
                                    </f:facet>
                                </rich:messages>
                            </h:panelGroup>
                        </td>
                    </tr>
                </table>
            </body>
        </html>
    </h:form>
    <script type="text/javascript">
        function foco() {
            el('DEUsuario:nome').focus();
        }
    </script>
</f:view>
